var express = require('express');
var router = express.Router();

//加载模型
const CateModel = require('../../models')['Cate']

//获取新闻分类数据
router.get('/cates',async (req,res)=>{
    try {
        //查询新闻分类数据,按照排序数字的倒序排列
        const cates = await CateModel.findAll({
            order: [
                ['sort', 'DESC']
            ]
        });
        res.cc(200,'',cates)
    }catch(e){
        res.cc(400,e.message)
    }  
})

module.exports=router